<template>
  <el-carousel :interval="5000" type="card" height="284px" indicator-position="none">
    <el-carousel-item v-for="(item,index) in banners" :key="index">
      <img class="image" :src="item.imageUrl" alt="">
    </el-carousel-item>
  </el-carousel>
</template>

<script>
import {getBanner} from "@/network/recommend/banner";

export default {
  name: "Banner",
  data() {
    return {
      banners: [],
    }
  },
  created() {
    this.getBanners()
  },
  methods: {
    async getBanners() {//获取轮播图
      const {data: res} = await getBanner(0)
      // if (res.code === 200) {
      //   this.$message.success('获取轮播图成功！')
      // } else {
      //   return this.$message.error('我在获取轮播图时出了点意外呢！')
      // }
      this.banners = res.banners
      
    }
  },
}
</script>

<style scoped lang="less">
.el-carousel__item {
  display: flex;
  justify-content: center;
  box-shadow: 40px 40px 40px #000000;
  
  
  .image {
    color: #475669;
    font-size: 18px;
    opacity: 0.75;
    line-height: 300px;
    margin: 0;
    height: 284px;
    width: 730px;
    transition: all .4s cubic-bezier(0.8, 0.15, 0.3, 0.73);
    
    &:hover {
      transform: translateY(-3px);
      opacity: .9;
    }
  }
}

/deep/ .el-carousel__arrow--left {
  left: 300px;
  background-color: #b4b1af;
  box-shadow: 40px 40px 40px #000000;
  
  &:hover {
    box-shadow: 5px 5px 20px #000000;
    transform: translateY(1px);
  }
}

/deep/ .el-carousel__arrow--right {
  right: 300px;
  background-color: #b4b1af;
  
  &:hover {
    box-shadow: 5px 5px 20px #000000;
    transform: translateY(1px);
  }
  
}

/deep/ .el-carousel__container {
  background-color: rgba(36, 36, 36, 0.99);
}

</style>
